package cn.milolab.djback.conf.requestprocessor;

import cn.milolab.djback.conf.DjException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import sun.rmi.runtime.Log;

import java.util.Arrays;

/**
 * 当接受到DjException类型的异常时，使requestHandler返回原本的异常，而非spring自动生成的消息
 * 之后被ResponseBodyWrapper捕获，封装成标准返回体
 *
 * @author milowang
 */
@Slf4j
@RestControllerAdvice
public class DjExceptionConverter {

    @ExceptionHandler(DjException.class)
    public DjException djExceptionHandler(DjException ex) {
        ex.printStackTrace();
        return ex;
    }
}
